The present invention relates to a bar code scanner using a line image sensor.
A conventional bar code scanner uses a line image sensor 1, such as a CCD sensor or a MOS sensor as shown in FIG. 1, to read black and white lines of a bar code with a resolution of, e.g., 2048 pixels per line. The output of image sensor 1 is amplified by preamplifier 2 and inverting amplifier 3, and is sampled and held by sample/hold circuit 4. After the high-frequency component of the output from circuit 4 is rejected by low-pass filter 5, the output is supplied to one input terminal of comparator 6 and to the other input terminal thereof through slice level determination circuit 7. Comparator 6 converts an input signal directly supplied from low-pass filter 5 into a binary signal with reference to a slice level of the output signal from circuit 7 as a reference level, and produces binary signal S corresponding to a black or white portion of the bar code.
Slice level determination circuit 7 has, e.g., an arrangement as shown in FIG. 2. More particularly, circuit 7 has diodes 8 and 9 connected in parallel with each other for receiving output LPS from low-pass filter 5 at their anode and cathode, respectively, capacitor 10 having one end connected to the cathode and anode of respective diodes 8 and 9 and the other end grounded, and amplifier 11, having a buffer structure with a unity gain, for amplifying the charged voltage of capacitor 10 and outputting the amplified voltage as slice level signal SLS.
The operation of the bar code scanner using slice level determination circuit 7 will be described with reference to the output waveforms shown in FIGS. 3A to 3E. First, a video signal shown in FIG. 3A is output from image sensor 1, and is amplified and inverted by amplifier 3 to obtain an output having a waveform as shown in FIG. 3B. This output is sampled and held by sample/hold circuit 4 to make enveloped waveform as shown in FIG. 3C. The high-frequency component of this output is rejected by low-pass filter 5 to have a smooth waveform indicated by a solid line in FIG. 3D and is input to comparator 6. The output of low-pass filter 5 is also supplied to circuit 7 and it determines the level of an output signal a level indicated by a broken line in FIG. 3D, and then supplies the output signal to comparator 6. In circuit 7, when the input voltage from low-pass filter 5 is higher than the terminal voltage of capacitor 10, it charges capacitor 10 via diode 8 to maintain its charging voltage to a level obtained by subtracting the forward voltage drop (about 0.5 V) of diode 8 from the input voltage. Capacitor 10 holds the charging level obtained when the input voltage is at its maximum level until the input voltage is decreased to a level obtained by subtracting the forward voltage drop (about 0.5 V) of diode 9 from the holding voltage of capacitor 10.
When the input voltage is decreased to a level obtained by subtracting the forward voltage drop of diode 9 from the holding voltage of capacitor 10, the charges of capacitor 10 are discharged via diode 9, and the voltage of capacitor 10 is constantly held at a level obtained by adding the forward voltage drop of diode 9 to the input voltage.
In this manner, the charging level of capacitor 10 varies between the level obtained by subtracting the forward voltage drop of diode 8 from the maximum peak voltage when the input voltage is high and the level obtained by adding the forward voltage drop of diode 9 to the minimum peak voltage when the input voltage is low. Therefore, when the input voltage is high, the slice level is lower than the input voltage level by about 0.5 V and, when the input voltage is low, the slice level is higher than the input voltage level by about 0.5 V. Comparator 6 converts the output of low-pass filter 5 into a binary signal, as shown in FIG. 3E, in accordance with input slice level signal SLS as described above. In other words, the low level of the binary signal represents a white signal and the high level thereof represents a black signal.
In order to read a bar code by a line image sensor, its image is first formed using a lens. In this case, however, because of the aperture efficiency of the lens and the cosine biquadratic laws, the intensity of the incident light at the peripheral portion of the sensor is decreased compared to that at its central portion, and the video signal from the sensor actually has a substantially semicircular waveform, as shown in FIG. 4, having its central portion as a peak. In other words, the video signal has a shading waveform. Therefore, as shown in FIG. 5A, at a signal portion in the vicinity of the central component of the video signal which corresponds to the central region of the bar code, the relationship between the output level (the waveform in the solid line) of low-pass filter 5 and the slice level (the waveform in the broken line) is maintained correct, i.e., the slice level changes in accordance with the change in output level of low-pass filter 5. Hence, as shown in FIG. 5B, the width of the black or white binary signal corresponds to the width of the black or white line of the actual bar code. Regarding the video signal envelope components which correspond to the regions on the two sides of the bar code, at a rising waveform portion, the charging level of capacitor 10 can sufficiently follow the change in input voltage. Therefore, as shown in FIG. 6A, the relationship between the output level (the waveform in the solid line) and the slice level (the waveform in the broken line) is maintained substantially correct, and the width of the black or white binary signal corresponds to the width of the black or white line of the actual bar code, as shown in FIG. 6B.
However, at a falling waveform portion, since the charging voltage of capacitor 10 has a tendency to be held at the peak level, it cannot follow the change in input voltage. As a result, as shown in FIG. 7A, the relationship between the output level (the waveform in the solid line) of low-pass filter 5 and the slice level (the waveform in the broken line) is no longer correct, and the inverting timing of binary signal S from white to black signals is advanced, as shown in FIG. 7B. As a result, the width of the white signal is decreased, and the width of the black signal is increased. Note that FIG. 7C shows a binary signal with respect to an input voltage when the above relationship is correct.
Conventional bar code scanners may, therefore, erroneously read the line width of a bar code.
In order to solve this problem, resistor 12 can be connected in parallel with capacitor 10, as shown in FIG. 8. In this case, the charges of capacitor 10 are constantly discharged via resistor 12. Therefore, as shown in FIG. 9A, even if output LPS (the waveform in the solid line) of low-pass filter 5 is gradually decreased at a falling waveform portion, the charging level of capacitor 10 can be decreased accordingly and the slice level (the waveform in the broken line) can be changed. As a result, as shown in FIG. 9B, the inverting timing of the binary signal from white to black signal can be corrected to that of the correct binary signal as shown in FIG. 9C. In this case, however, charges of capacitor 10 are discharged even if video signal LPS from low-pass filter 5 is at low level. Thus, when a black line having a large width is detected, the slice level gradually decreases even if input voltage LPS is constant. Then, the levels of charging and input voltages are inverted to advance the inverting timing of the binary signal from black to white signal, and the width of the white signal is increased. In this manner, even with the above arrangement, the line width of a bar code may be erroneously read, and a reliable countermeasure cannot thus be provided.